#!/usr/bin/env php
<?php
/**
 * Generated from 'gentexconfig.in' on mié jun 15 11:00:03 COT 2011.
 *
 * This script outputs configuration settings in TeX format for
 * inclusion in the team manual. When the system is still
 * unconfigured, it tries to get the configuration from a direct path
 * inclusion or reverts to defaults; this allows a team manual to be
 * included in the source distribution.
 *
 * $Id: gentexconfig.in 3120 2010-02-22 23:10:26Z eldering $
 *
 * Part of the DOMjudge Programming Contest Jury System and licenced
 * under the GNU GPL. See README and COPYING for details.
 */
if ( isset($_SERVER['REMOTE_ADDR']) ) die ("Commandline use only");

$config = '/usr/local/domjudge/domserver/etc/domserver-static.php';

// This script might be run before or after autoconf variable
// substitution, so we try to read the config from all possible
// places:
if ( is_readable($config) ) {
	require($config);
	require(ETCDIR . '/domserver-config.php');
	@include(ETCDIR . '/judgehost-config.php');
} else {
	@include('../../etc/domserver-config.php');
	@include('../../etc/judgehost-config.php');
	define('DOMJUDGE_VERSION', `sed -n '1s/.*version //p' ../../README | tr -d '\n'`);
}

$configvars = array(
	'WEBBASEURI'                => $_SERVER['argv'][1],
	'DOMJUDGE_VERSION'          => 'unknown',
	'SOURCESIZE'                => 256,
	'COMPILETIME'               => 30,
	'MEMLIMIT'                  => 524288,
	'FILELIMIT'                 => 4096,
	'PROCLIMIT'                 => 10,
	'USERSUBMITDIR'             => '.domjudge',
	'SUBMIT_DEFAULT'            => '2',
	);

foreach ($configvars as $var => $default) {
	$value = defined($var) ? constant($var) : $default;
	echo '\\def\\' . str_replace('_', '', $var) . '{' . $value . "}\n";
}

exit(0);
